<template>
  <div class="box">
    <div id="" style="margin-bottom: 30px;">
      <el-button :type="type=='数据融合配置'?'primary':''" v-has @click="type='数据融合配置'">数据融合配置</el-button>
      <el-button :type="type=='数据筛选配置'?'primary':''" v-has @click="type='数据筛选配置'">数据筛选配置</el-button>
    </div>
    
    <template v-if="type=='数据融合配置'">
      <el-table  ref="multipleTable" :data="tableData1" border tooltip-effect="dark" fit stripe highlight-current-row>
        <el-table-column type="selection"></el-table-column>
        <el-table-column v-for="item in tableHead1" :key="item.id" :label="item.label" :prop="item.title"
          align="center">
          <template v-slot="scope">
            <div v-if="item.title!='oper1'">
              {{scope.row[item.title]}}
            </div>
            <div v-else>
              <el-button type="primary" size="mini">规范查阅</el-button>
            </div>
          </template>
        </el-table-column>
      </el-table>
    </template>
    <template v-if="type=='数据筛选配置'">
      <el-table ref="multipleTable" :data="tableData2" border tooltip-effect="dark" fit stripe highlight-current-row>
        <el-table-column type="selection"></el-table-column>
        <el-table-column v-for="item in tableHead2" :key="item.id" :label="item.label" :prop="item.title"
          align="center">
          <template v-slot="scope">
            <div v-if="item.title!='oper2'">
              {{scope.row[item.title]}}
            </div>
            <div v-else>
              <el-button type="primary" size="mini">明细查询</el-button>
              <el-button type="primary" size="mini">明细统计</el-button>
            </div>
          </template>
        </el-table-column>
      </el-table>
    </template>
    
  </div>
</template>

<script>
  export default {
    data() {
      return {
        ruleForm: {},
        formData: {},
        ruleForm1: {},
        formData1: {},
        ruleForm2: {},
        formData2: {},
        fileList: [],
        type: '数据导入',
        tableHead1: [{
            id: 1,
            label: "字段名称",
            title: "name",
          },
          {
            id: 2,
            label: "列",
            title: "column",
          },
          {
            id: 3,
            label: "类型",
            title: "type",
          },
          {
            id: 4,
            label: "格式",
            title: "format",
          },
          {
            id: 5,
            label: "长度",
            title: "length",
          },
          {
            id: 6,
            label: "精度",
            title: "precision",
          }
        ],
        tableData1: [{
          name: "key1",
          column: '键',
          type: 'Number',
          format: '1',
          length: '10',
          precision: '1'
        },
        {
          name: "key2",
          column: '值',
          type: 'String',
          format: '10',
          length: '10',
          precision: ''
        }],
        
        formData: {},

        tableHead2: [{
            id: 1,
            label: "编号",
            title: "id",
          },
          {
            id: 2,
            label: "表字段",
            title: "tableField",
          },
          {
            id: 3,
            label: "流字段",
            title: "streamField",
          }
        ],
        tableData2: [{
          id: "1",
          tableField: 'ID',
          streamField: 'ID'
        },
        {
          id: "2",
          tableField: 'NAME',
          streamField: 'NAME'
        },
        {
          id: "3",
          tableField: 'PWD',
          streamField: 'PWD'
        },
        {
          id: "4",
          tableField: 'TYPE',
          streamField: 'TYPE'
        },
        {
          id: "5",
          tableField: 'ROLE',
          streamField: 'ROLE'
        }
        ]
        
      };
    },
    computed: {
      uploadFile() {
        return process.env.VUE_APP_BASE_API + "/dc/importCustomer";
      },
      headers() {
        const head = {
          token: this.$store.getters.token,
        };
        return head;
      },
    },
    methods: {
      submitForm() {
        this.$message({
          type: "success",
          message: '上传目录成功'
        })
      },
      resetForm() {

      }
    }
  }
</script>

<style lang="scss" scoped>
  .box {
    padding: 30px;
  }
</style>
